# Copyright (c) [2020] [蒋奕成]. You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2 THIS SOFTWARE IS PROVIDED ON AN "AS
# IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.

import os
import subprocess
import time
import webbrowser
import sqlalchemy
from sqlalchemy.orm import sessionmaker

import models


engine = sqlalchemy.create_engine("sqlite:///db.db")
session = sessionmaker(engine)()
models.Base.metadata.create_all(engine)
#session.commit()
# class login:
#     def __init__(self):
#         self.base_url = "wemeet://page/inmeeting?meeting_code="
#         self.mc = ""
#         self.url_r = ""
#         self.file_path = "Meetinglist.json"
#         self.cmd = "taskkill /f /im wemeetapp.exe"
#
#     def get_opts(self, filepath):
#         file = open(filepath, mode="r+", encoding="utf-8")
#         file.seek(0)
#         result = eval(file.readlines()[0])
#         return result
#
#     def run(self, weeks, nums):
#         time1 = time.time()
#         subprocess.getoutput(self.cmd)
#         weeks = str(weeks)
#         nums = str(nums)
#         num = self.read(self.file_path)
#         num = eval(num)
#         self.mc = num[weeks][nums]
#         self.url_r = self.url + str(self.mc)
#         meet_code = str(self.mc)
#         # print(str(self.url_r))
#         webbrowser.open(self.url_r)
#         time2 = time.time()
#         use_time = time2 - time1
#         print('完成任务:启动星期' + str(weeks) + '的第' + str(nums) + '节课,会议号为:' + str(meet_code) + '.用时:' + str(int(use_time)) +
#               '秒.')
